﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;

namespace MusicPlayerPlus.Core
{
    public class AddPlugIn
    {
        public AddPlugIn()
        {
        }

        #region ReflectionObject

        #region Action.Input

        #region Base

        Reflection.Action.Input.RAutoExecuteAction input_RAutoExecuteAction = new Reflection.Action.Input.RAutoExecuteAction();
        Reflection.Action.Input.RAddToButtonAction input_RAddToButtonAction = new Reflection.Action.Input.RAddToButtonAction();
        Reflection.Action.Input.RAddToMenuAction input_RAddToMenuAction = new Reflection.Action.Input.RAddToMenuAction();

        Reflection.Action.Input.RSetMainWindow input_RSetMainWindow = new Reflection.Action.Input.RSetMainWindow();
        Reflection.Action.Input.RMainWindowShow input_RMainWindowShow = new Reflection.Action.Input.RMainWindowShow();
        Reflection.Action.Input.RMainWindowHide input_RMainWindowHide = new Reflection.Action.Input.RMainWindowHide();
        Reflection.Action.Input.RMainWindowMin input_RMainWindowMin = new Reflection.Action.Input.RMainWindowMin();
        Reflection.Action.Input.RMainWindowMax input_RMainWindowMax = new Reflection.Action.Input.RMainWindowMax();
        #endregion

        #region Media

        Reflection.Action.Input.RTimeLineChangeAction input_RTimeLineChangeAction = new Reflection.Action.Input.RTimeLineChangeAction();
        Reflection.Action.Input.RChangeTimeLineAction input_RChangeTimeLineAction = new Reflection.Action.Input.RChangeTimeLineAction();
        Reflection.Action.Input.RBufferingTimeLineChangeAction input_RBufferingTimeLineChangeAction = new Reflection.Action.Input.RBufferingTimeLineChangeAction();
        Reflection.Action.Input.RVolumeChangeAction input_RVolumeChangeAction = new Reflection.Action.Input.RVolumeChangeAction();
        Reflection.Action.Input.RChangeVolumeAction input_RChangeVolumeAction = new Reflection.Action.Input.RChangeVolumeAction();
        Reflection.Action.Input.RPlayStateChangeAction input_RPlayStateChangeAction = new Reflection.Action.Input.RPlayStateChangeAction();
        Reflection.Action.Input.RPlayOrderChangeAction input_RPlayOrderChangeAction = new Reflection.Action.Input.RPlayOrderChangeAction();
        Reflection.Action.Input.RPlayAction input_RPlayAction = new Reflection.Action.Input.RPlayAction();
        Reflection.Action.Input.RPauseAction input_RPauseAction = new Reflection.Action.Input.RPauseAction();
        Reflection.Action.Input.RStopAction input_RStopAction = new Reflection.Action.Input.RStopAction();
        Reflection.Action.Input.RPreviousTrackAction input_RPreviousTrackAction = new Reflection.Action.Input.RPreviousTrackAction();
        Reflection.Action.Input.RNextTrackAction input_RNextTrackAction = new Reflection.Action.Input.RNextTrackAction();

        #endregion

        #region Data

        Reflection.Action.Input.RDictionaryChange input_RDictionaryChange = new Reflection.Action.Input.RDictionaryChange();
        Reflection.Action.Input.RPlayListChange input_RPlayListChange = new Reflection.Action.Input.RPlayListChange();
        Reflection.Action.Input.RMuiscListChange input_RMuiscListChange = new Reflection.Action.Input.RMuiscListChange();
        Reflection.Action.Input.RPlayMusicChange input_RPlayMusicChange = new Reflection.Action.Input.RPlayMusicChange();
        Reflection.Action.Input.ROrientationActionChange input_ROrientationActionChange = new Reflection.Action.Input.ROrientationActionChange();

        #endregion

        #endregion

        #region Action.Output

        #region Base

        Reflection.Action.Output.RInputLogAction output_RInputLogAction = new Reflection.Action.Output.RInputLogAction();
        Reflection.Action.Output.RAddToButtonAction output_RAddToButtonAction = new Reflection.Action.Output.RAddToButtonAction();
        Reflection.Action.Output.RAddToMenuAction output_RAddToMenuAction = new Reflection.Action.Output.RAddToMenuAction();

        Reflection.Action.Output.RSetMainWindow output_RSetMainWindow = new Reflection.Action.Output.RSetMainWindow();
        Reflection.Action.Output.RMainWindowShow output_RMainWindowShow = new Reflection.Action.Output.RMainWindowShow();
        Reflection.Action.Output.RMainWindowHide output_RMainWindowHide = new Reflection.Action.Output.RMainWindowHide();
        Reflection.Action.Output.RMainWindowMin output_RMainWindowMin = new Reflection.Action.Output.RMainWindowMin();
        Reflection.Action.Output.RMainWindowMax output_RMainWindowMax = new Reflection.Action.Output.RMainWindowMax();
        #endregion

        #region Media

        Reflection.Action.Output.RTimeLineChangeAction output_RTimeLineChangeAction = new Reflection.Action.Output.RTimeLineChangeAction();
        Reflection.Action.Output.RChangeTimeLineAction output_RChangeTimeLineAction = new Reflection.Action.Output.RChangeTimeLineAction();
        Reflection.Action.Output.RBufferingTimeLineChangeAction output_RBufferingTimeLineChangeAction = new Reflection.Action.Output.RBufferingTimeLineChangeAction();
        Reflection.Action.Output.RVolumeChangeAction output_RVolumeChangeAction = new Reflection.Action.Output.RVolumeChangeAction();
        Reflection.Action.Output.RChangeVolumeAction output_RChangeVolumeAction = new Reflection.Action.Output.RChangeVolumeAction();
        Reflection.Action.Output.RPlayStateChangeAction output_RPlayStateChangeAction = new Reflection.Action.Output.RPlayStateChangeAction();
        Reflection.Action.Output.RPlayOrderChangeAction output_RPlayOrderChangeAction = new Reflection.Action.Output.RPlayOrderChangeAction();
        Reflection.Action.Output.RPlayAction output_RPlayAction = new Reflection.Action.Output.RPlayAction();
        Reflection.Action.Output.RPauseAction output_RPauseAction = new Reflection.Action.Output.RPauseAction();
        Reflection.Action.Output.RStopAction output_RStopAction = new Reflection.Action.Output.RStopAction();
        Reflection.Action.Output.RPreviousTrackAction output_RPreviousTrackAction = new Reflection.Action.Output.RPreviousTrackAction();
        Reflection.Action.Output.RNextTrackAction output_RNextTrackAction = new Reflection.Action.Output.RNextTrackAction();

        #endregion

        #region MusicList

        Reflection.Action.Output.RGetMusicListAction output_RGetMusicListAction = new Reflection.Action.Output.RGetMusicListAction();
        Reflection.Action.Output.RChangeMusicListAction output_RChangeMusicListAction = new Reflection.Action.Output.RChangeMusicListAction();
        Reflection.Action.Output.RAddMusicListAction output_RAddMusicListAction = new Reflection.Action.Output.RAddMusicListAction();

        Reflection.Action.Output.RGetPlayMusicAction output_RGetPlayMusicAction = new Reflection.Action.Output.RGetPlayMusicAction();
        Reflection.Action.Output.RSetPlayMusicAction output_RSetPlayMusicAction = new Reflection.Action.Output.RSetPlayMusicAction();
        Reflection.Action.Output.RAddMusicAction output_RAddMusicAction = new Reflection.Action.Output.RAddMusicAction();
        Reflection.Action.Output.RChangeMusicAction output_RChangeMusicAction = new Reflection.Action.Output.RChangeMusicAction();
        Reflection.Action.Output.RDeleteMusicAction output_RDeleteMusicAction = new Reflection.Action.Output.RDeleteMusicAction();

        #endregion

        #region PlayList

        Reflection.Action.Output.RGetPlayListAction output_RGetPlayListAction = new Reflection.Action.Output.RGetPlayListAction();
        Reflection.Action.Output.RChangePlayListAction output_RChangePlayListAction = new Reflection.Action.Output.RChangePlayListAction();
        Reflection.Action.Output.RAddPlayListAction output_RAddPlayListAction = new Reflection.Action.Output.RAddPlayListAction();
        Reflection.Action.Output.RDeletePlayListAction output_RDeletePlayListAction = new Reflection.Action.Output.RDeletePlayListAction();

        Reflection.Action.Output.RGetPlayListForGuidAction output_RGetPlayListForGuidAction = new Reflection.Action.Output.RGetPlayListForGuidAction();
        Reflection.Action.Output.RGetPlayingPlayListAction output_RGetPlayingPlayListAction = new Reflection.Action.Output.RGetPlayingPlayListAction();
        #endregion

        #region Dictionary

        Reflection.Action.Output.RGetDictionaryData output_RGetDictionaryData = new Reflection.Action.Output.RGetDictionaryData();
        Reflection.Action.Output.RAddDictionaryData output_RAddDictionaryData = new Reflection.Action.Output.RAddDictionaryData();
        Reflection.Action.Output.RChangeDictionaryData output_RChangeDictionaryData = new Reflection.Action.Output.RChangeDictionaryData();
        Reflection.Action.Output.RDeleteDictionaryData output_RDeleteDictionaryData = new Reflection.Action.Output.RDeleteDictionaryData();

        Reflection.Action.Output.ROrientationAction output_ROrientationAction = new Reflection.Action.Output.ROrientationAction();
        #endregion


        #endregion

        Reflection.RInterfaceBase rInterfaceBase = new Reflection.RInterfaceBase();

        #endregion

        private Interactive interactive = new Interactive();

        /// <summary>
        /// 实例化
        /// </summary>
        /// <param name="assemblyFile">程序集路径</param>
        public void Instantiation(string assemblyFile)
        {
            Assembly assembly = Assembly.LoadFrom(assemblyFile);
            Type[] allTypelist = assembly.GetTypes();

            foreach (var item in allTypelist)
            {
                object obj = rInterfaceBase.Execute(item);
                if (obj != null)
                {
                    #region Action.Input

                    //Base
                    input_RAutoExecuteAction.Execute(item, obj);
                    input_RAddToButtonAction.Execute(item, obj);
                    input_RAddToMenuAction.Execute(item, obj);

                    input_RSetMainWindow.Execute(item, obj);
                    input_RMainWindowShow.Execute(item, obj);
                    input_RMainWindowHide.Execute(item, obj);
                    input_RMainWindowMin.Execute(item, obj);
                    input_RMainWindowMax.Execute(item, obj);

                    //Media
                    input_RTimeLineChangeAction.Execute(item, obj);
                    input_RChangeTimeLineAction.Execute(item, obj);
                    input_RBufferingTimeLineChangeAction.Execute(item, obj);
                    input_RVolumeChangeAction.Execute(item, obj);
                    input_RChangeVolumeAction.Execute(item, obj);
                    input_RPlayStateChangeAction.Execute(item, obj);
                    input_RPlayOrderChangeAction.Execute(item, obj);
                    input_RPlayAction.Execute(item, obj);
                    input_RPauseAction.Execute(item, obj);
                    input_RStopAction.Execute(item, obj);
                    input_RPreviousTrackAction.Execute(item, obj);
                    input_RNextTrackAction.Execute(item, obj);

                    //Data
                    input_RDictionaryChange.Execute(item, obj);
                    input_RPlayListChange.Execute(item, obj);
                    input_RMuiscListChange.Execute(item, obj);
                    input_RPlayMusicChange.Execute(item, obj);

                    input_ROrientationActionChange.Execute(item, obj);
                    #endregion

                    #region Action.Output

                    //Base
                    output_RInputLogAction.Execute(item, obj);
                    output_RAddToButtonAction.Execute(item, obj);
                    output_RAddToMenuAction.Execute(item, obj);

                    output_RSetMainWindow.Execute(item, obj);
                    output_RMainWindowShow.Execute(item, obj);
                    output_RMainWindowHide.Execute(item, obj);
                    output_RMainWindowMin.Execute(item, obj);
                    output_RMainWindowMax.Execute(item, obj);

                    //Media
                    output_RTimeLineChangeAction.Execute(item, obj);
                    output_RChangeTimeLineAction.Execute(item, obj);
                    output_RBufferingTimeLineChangeAction.Execute(item, obj);
                    output_RVolumeChangeAction.Execute(item, obj);
                    output_RChangeVolumeAction.Execute(item, obj);
                    output_RPlayStateChangeAction.Execute(item, obj);
                    output_RPlayOrderChangeAction.Execute(item, obj);
                    output_RPlayAction.Execute(item, obj);
                    output_RPauseAction.Execute(item, obj);
                    output_RStopAction.Execute(item, obj);
                    output_RPreviousTrackAction.Execute(item, obj);
                    output_RNextTrackAction.Execute(item, obj);

                    //MusicList
                    output_RGetMusicListAction.Execute(item, obj);
                    output_RChangeMusicListAction.Execute(item, obj);
                    output_RAddMusicListAction.Execute(item, obj);

                    output_RGetPlayMusicAction.Execute(item, obj);
                    output_RSetPlayMusicAction.Execute(item, obj);
                    output_RAddMusicAction.Execute(item, obj);
                    output_RChangeMusicAction.Execute(item, obj);
                    output_RDeleteMusicAction.Execute(item, obj);

                    //PlayList
                    output_RGetPlayListAction.Execute(item, obj);
                    output_RChangePlayListAction.Execute(item, obj);
                    output_RAddPlayListAction.Execute(item, obj);
                    output_RDeletePlayListAction.Execute(item, obj);
                    output_RGetPlayListForGuidAction.Execute(item, obj);
                    output_RGetPlayingPlayListAction.Execute(item, obj);

                    //Dictionary
                    output_RGetDictionaryData.Execute(item, obj);
                    output_RAddDictionaryData.Execute(item, obj);
                    output_RChangeDictionaryData.Execute(item, obj);
                    output_RDeleteDictionaryData.Execute(item, obj);
                    output_ROrientationAction.Execute(item, obj);

                    #endregion
                }
            }
        }

        /// <summary>
        /// 自动执行代码
        /// </summary>
        public void AutoExecute()
        {
            interactive.AutoExecute();
        }
    }
}
